<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>属性选择符 | H5学习笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="逍遥派">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-expandable-chapters-interactive/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../../md/css/selector/elements.html" />
    
    
    <link rel="prev" href="../../../md/css/selector/pseudo.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="2.1.9"
        data-chapter-title="属性选择符"
        data-filepath="md/css/selector/att.md"
        data-basepath="../../.."
        data-revision="Tue Dec 12 2017 18:08:21 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html.html">
            
                
                    <a href="../../../md/html/html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/know.html">
            
                
                    <a href="../../../md/html/know.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        认识页面、以及行内元素和块级元素
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="md/html/a.html">
            
                
                    <a href="../../../md/html/a.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.1.</b>
                        
                        a标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="md/html/path.html">
            
                
                    <a href="../../../md/html/path.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.2.</b>
                        
                        文件路径
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.3" data-path="md/html/img.html">
            
                
                    <a href="../../../md/html/img.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.3.</b>
                        
                        img标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.4" data-path="md/html/area.html">
            
                
                    <a href="../../../md/html/area.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.4.</b>
                        
                        锚点和热区
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.5" data-path="md/html/table.html">
            
                
                    <a href="../../../md/html/table.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.5.</b>
                        
                        表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.6" data-path="md/html/media.html">
            
                
                    <a href="../../../md/html/media.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.6.</b>
                        
                        音频与视频
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.7" data-path="md/html/list.html">
            
                
                    <a href="../../../md/html/list.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.7.</b>
                        
                        列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.8" data-path="md/html/jframe.html">
            
                
                    <a href="../../../md/html/jframe.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.8.</b>
                        
                        内嵌页面
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.9" data-path="md/html/icon.html">
            
                
                    <a href="../../../md/html/icon.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.9.</b>
                        
                        网页icon
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.10" data-path="md/html/character.html">
            
                
                    <a href="../../../md/html/character.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.10.</b>
                        
                        实体字符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.11" data-path="md/html/form.html">
            
                
                    <a href="../../../md/html/form.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.11.</b>
                        
                        form表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.12" data-path="md/html/input.html">
            
                
                    <a href="../../../md/html/input.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.</b>
                        
                        input标签
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.12.1" data-path="md/html/input/radio.html">
            
                
                    <a href="../../../md/html/input/radio.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.1.</b>
                        
                        radio
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.12.2" data-path="md/html/input/checkbox.html">
            
                
                    <a href="../../../md/html/input/checkbox.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.2.</b>
                        
                        checkbox
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.12.3" data-path="md/html/input/select.html">
            
                
                    <a href="../../../md/html/input/select.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.3.</b>
                        
                        select
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.12.4" data-path="md/html/input/file.html">
            
                
                    <a href="../../../md/html/input/file.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.4.</b>
                        
                        file
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.12.5" data-path="md/html/input/textarea.html">
            
                
                    <a href="../../../md/html/input/textarea.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.5.</b>
                        
                        textarea
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.12.6" data-path="md/html/input/button.html">
            
                
                    <a href="../../../md/html/input/button.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.12.6.</b>
                        
                        button
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css.html">
            
                
                    <a href="../../../md/css/css.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/selector.html">
            
                
                    <a href="../../../md/css/selector.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        CSS选择器
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="md/css/selector/element.html">
            
                
                    <a href="../../../md/css/selector/element.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.1.</b>
                        
                        元素选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="md/css/selector/class.html">
            
                
                    <a href="../../../md/css/selector/class.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.2.</b>
                        
                        类选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="md/css/selector/id.html">
            
                
                    <a href="../../../md/css/selector/id.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.3.</b>
                        
                        ID选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="md/css/selector/descendant.html">
            
                
                    <a href="../../../md/css/selector/descendant.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.4.</b>
                        
                        后代选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="md/css/selector/child.html">
            
                
                    <a href="../../../md/css/selector/child.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.5.</b>
                        
                        子元素选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="md/css/selector/general.html">
            
                
                    <a href="../../../md/css/selector/general.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.6.</b>
                        
                        兄弟选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="md/css/selector/adjacent.html">
            
                
                    <a href="../../../md/css/selector/adjacent.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.7.</b>
                        
                        相邻选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="md/css/selector/pseudo.html">
            
                
                    <a href="../../../md/css/selector/pseudo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.8.</b>
                        
                        伪类选择符
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="2.1.9" data-path="md/css/selector/att.html">
            
                
                    <a href="../../../md/css/selector/att.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.9.</b>
                        
                        属性选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="md/css/selector/elements.html">
            
                
                    <a href="../../../md/css/selector/elements.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.10.</b>
                        
                        伪元素选择符
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/gitbook/introduce.html">
            
                
                    <a href="../../../md/gitbook/introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        gitbook
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="md/gitbook/use.html">
            
                
                    <a href="../../../md/gitbook/use.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        gitbook安装及使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/gitbook/mardown.html">
            
                
                    <a href="../../../md/gitbook/mardown.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Markdown编辑器语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/gitbook/plugins.html">
            
                
                    <a href="../../../md/gitbook/plugins.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        Markdown插件安装配置
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/node.js/introduce.html">
            
                
                    <a href="../../../md/node.js/introduce.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        NodeJs
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/node.js/nvm.html">
            
                
                    <a href="../../../md/node.js/nvm.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        nvm管理nodejs
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="md/node.js/npm.html">
            
                
                    <a href="../../../md/node.js/npm.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        npm介绍及使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../../" >H5学习笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x7B26;">&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x7B26;</h1>
<p>&#x5BF9;&#x5E26;&#x6709;&#x6307;&#x5B9A;&#x5C5E;&#x6027;&#x7684; HTML &#x5143;&#x7D20;&#x8BBE;&#x7F6E;&#x6837;&#x5F0F;<br>&#x53EF;&#x4EE5;&#x4E3A;&#x62E5;&#x6709;&#x6307;&#x5B9A;&#x5C5E;&#x6027;&#x7684; HTML &#x5143;&#x7D20;&#x8BBE;&#x7F6E;&#x6837;&#x5F0F;&#xFF0C;&#x800C;&#x4E0D;&#x4EC5;&#x9650;&#x4E8E; class &#x548C; id &#x5C5E;&#x6027;&#x3002;</p>
<p><img src="../../media/att.png" alt="&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x7B26;"></p>
<h2 id="&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;">&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;</h2>
<p>&#x4E3A;&#x5E26;&#x6709; title &#x5C5E;&#x6027;&#x7684; &#x5143;&#x7D20;&#x8BBE;&#x7F6E;&#x6837;&#x5F0F;</p>
<pre><code>[title]
{
color:red;
}
</code></pre><h2 id="&#x5C5E;&#x6027;&#x548C;&#x503C;&#x9009;&#x62E9;&#x5668;">&#x5C5E;&#x6027;&#x548C;&#x503C;&#x9009;&#x62E9;&#x5668;</h2>
<p>&#x4E3A; title=&quot;hehe&quot; &#x7684; &#x5143;&#x7D20;&#x8BBE;&#x7F6E;&#x6837;&#x5F0F;</p>
<pre><code>[title=&quot;hehe&quot;]
{
border:5px solid blue;
}
</code></pre><h2 id="&#x5C5E;&#x6027;&#x548C;&#x503C;&#x9009;&#x62E9;&#x5668;--&#x591A;&#x4E2A;&#x503C;">&#x5C5E;&#x6027;&#x548C;&#x503C;&#x9009;&#x62E9;&#x5668; - &#x591A;&#x4E2A;&#x503C;</h2>
<p>&#x9009;&#x62E9; titile &#x5C5E;&#x6027;&#x5305;&#x542B;&#x5355;&#x8BCD; &quot;flower&quot; &#x7684;&#x5143;&#x7D20;&#xFF0C;&#x5E76;&#x8BBE;&#x7F6E;&#x5176;&#x6837;&#x5F0F;</p>
<pre><code>[title~=flower] { color:red; }
</code></pre><h2 id="&#x5339;&#x914D;&#x5C5E;&#x6027;&#x503C;&#x4EE5;&#x6307;&#x5B9A;&#x503C;&#x5F00;&#x5934;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x3002;">&#x5339;&#x914D;&#x5C5E;&#x6027;&#x503C;&#x4EE5;&#x6307;&#x5B9A;&#x503C;&#x5F00;&#x5934;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x3002;</h2>
<p>&#x8BBE;&#x7F6E; class &#x5C5E;&#x6027;&#x503C;&#x4EE5; &quot;test&quot; &#x5F00;&#x5934;&#x7684;&#x6240;&#x6709; div &#x5143;&#x7D20;&#x7684;&#x80CC;&#x666F;&#x8272;&#xFF1A;</p>
<pre><code>div[class^=&quot;test&quot;]
{
background:#ffff00;
}
</code></pre><h2 id="&#x7528;&#x4E8E;&#x9009;&#x53D6;&#x5E26;&#x6709;&#x4EE5;&#x6307;&#x5B9A;&#x503C;&#x5F00;&#x5934;&#x7684;&#x5C5E;&#x6027;&#x503C;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x8BE5;&#x503C;&#x5FC5;&#x987B;&#x662F;&#x6574;&#x4E2A;&#x5355;&#x8BCD;&#x3002;">&#x7528;&#x4E8E;&#x9009;&#x53D6;&#x5E26;&#x6709;&#x4EE5;&#x6307;&#x5B9A;&#x503C;&#x5F00;&#x5934;&#x7684;&#x5C5E;&#x6027;&#x503C;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x8BE5;&#x503C;&#x5FC5;&#x987B;&#x662F;&#x6574;&#x4E2A;&#x5355;&#x8BCD;&#x3002;</h2>
<p>&#x9009;&#x62E9; lang &#x5C5E;&#x6027;&#x503C;&#x4EE5; &quot;en&quot; &#x5F00;&#x5934;&#x7684;&#x5143;&#x7D20;&#xFF0C;&#x5E76;&#x8BBE;&#x7F6E;&#x5176;&#x6837;&#x5F0F;&#xFF1A;</p>
<pre><code>[lang|=en]
{ 
background-color:yellow;
}
</code></pre><h2 id="&#x5339;&#x914D;&#x5C5E;&#x6027;&#x503C;&#x4EE5;&#x6307;&#x5B9A;&#x503C;&#x7ED3;&#x5C3E;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x3002;">&#x5339;&#x914D;&#x5C5E;&#x6027;&#x503C;&#x4EE5;&#x6307;&#x5B9A;&#x503C;&#x7ED3;&#x5C3E;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x3002;</h2>
<p>&#x8BBE;&#x7F6E; class &#x5C5E;&#x6027;&#x503C;&#x4EE5; &quot;test&quot; &#x7ED3;&#x5C3E;&#x7684;&#x6240;&#x6709; div &#x5143;&#x7D20;&#x7684;&#x80CC;&#x666F;&#x8272;&#xFF1A;</p>
<pre><code>div[class$=&quot;test&quot;]
{
background:#ffff00;
}
</code></pre><h2 id="&#x5339;&#x914D;&#x5C5E;&#x6027;&#x503C;&#x4E2D;&#x5305;&#x542B;&#x6307;&#x5B9A;&#x503C;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;">&#x5339;&#x914D;&#x5C5E;&#x6027;&#x503C;&#x4E2D;&#x5305;&#x542B;&#x6307;&#x5B9A;&#x503C;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;</h2>
<p>&#x8BBE;&#x7F6E; class &#x5C5E;&#x6027;&#x503C;&#x5305;&#x542B; &quot;test&quot; &#x7684;&#x6240;&#x6709; div &#x5143;&#x7D20;&#x7684;&#x80CC;&#x666F;&#x8272;&#xFF1A;</p>
<pre><code>div[class*=&quot;test&quot;]
{
background:#ffff00;
}
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../../md/css/selector/pseudo.html" class="navigation navigation-prev " aria-label="Previous page: 伪类选择符"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../../md/css/selector/elements.html" class="navigation navigation-next " aria-label="Next page: 伪元素选择符"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../../gitbook/app.js"></script>

    
    <script src="../../../gitbook/plugins/gitbook-plugin-expandable-chapters-interactive/expandable-chapters.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters-interactive":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
